<?php
include_once("../../include/lxbase.class.php");
$userip = ($_SERVER["HTTP_VIA"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"];
if($userip!='103.7.220.216'){
	die(json_encode(array("error"=>1003,"msg"=>"access Forbidden")));
}
$webconn=new Lxbase();
$userid=intval($_GET["userid"]);
$id=intval($_GET["id"]);
$token=trim($_GET["token"],"'");
$ishave = $webconn->viewdata("id,wqid,wqtoken","wxuser","where userid={$userid}");
if(empty($ishave)){
	die(json_encode(array("error"=>1004,"msg"=>"No such user data")));
}
if($ishave["wqid"]!=$id || $ishave["wqtoken"]!=$token){
	$webconn->updata("wxuser","wqid={$id},wqtoken='{$token}'","where id={$ishave['id']}");
}
die(json_encode(array("error"=>1000,"msg"=>"success")));
	
